﻿-- Function: GuardarVenta(integer, character, integer,integer)

-- DROP FUNCTION GuardarVenta(integer, character, integer,integer)

CREATE OR REPLACE FUNCTION GuardarVenta(integer, integer, integer,float, float, float, float )
  RETURNS integer AS
$BODY$

DECLARE
	cliente			ALIAS FOR $1;
	folio			ALIAS FOR $2;
	totalArticulos		ALIAS FOR $3;
	subtotal		ALIAS FOR $4;
	iva			ALIAS FOR $5;
	descuento		ALIAS FOR $6;
	total			ALIAS FOR $7;
	
BEGIN
	insert into ventas(status,cliente,folio,totalarticulos,subtotal,iva,descuento,total) values('1',cliente,folio,totalArticulos,subtotal,iva,descuento,total);
	return 1;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
